<?php
namespace Admin\Controller;
 

class InteractiveController extends AdminController{
	public function index(){

		$data = new \Think\Model();
		$result = $data->query('select u.name uname,u.id uid,em.id emid,em.time,em.theme,em.content,em.cstatus  
				from love_email em,love_user u
				where em.uid = u.id
			');
		$res= $data->query('select   em.id emid,u.name uname,u.id uid
				from love_email em,love_user u
				where em.eid = u.id
			');

		for($i=0;$i<count($result);$i++){
			$result[$i]['ename']=$res[$i]['uname'];
		}
/*		var_dump($result);*/
		$this->assign('resu',$result);
		$this->display('Interactive/index');
	}

	public function edit(){
		$id = $_GET['id'];

		if((M('email')->delete("$id")>0)){
		//echo 	M('email')->getlastsql();exit;
			$this->success('删除成功', U('Interactive/index'));
		}else{
		//	echo 	M('email')->getlastsql();exit;
			$this->error('删除失败');
		}

	}


	public function xxadd(){
		 $content =$_POST['content'];
		 $id  = $_POST['id'];

		 $data = new \Think\Model();
		$result = $data->query("UPDATE love_email  SET content='$content' WHERE id =$id");
		if(empty($result)){
			 $this->ajaxReturn('修改成功');
		}else{
			$this->ajaxReturn('修改失败');
		}

	}


}
